<?php include "inc/conn.php"; ?>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>我的订单--启航纺织有限公司</title>
    <link href="home/css/bootstrap.min.css" rel="stylesheet">
    <link href="home/css/master.css" rel="stylesheet">
	
	<link href="home/css/model.css" rel="stylesheet">
    <!--[if lt IE 9]>
    <script src="js/html5shiv.js"></script>
    <script src="js/respond.min.js"></script>
    <![endif]-->

</head>

<body>
<!-- ##########页首########## -->
<?php include "inc/header.php"; ?>
<!-- ##########页首（end）########## -->
<!-- ##########主体########## -->
<link rel="stylesheet" href="home/css/reset.css">
<link rel="stylesheet" href="home/css/carts.css">
<div class="container">
	<!-- 固定图片广告 -->
	<div class="row">
		<img class="img-responsive model-img" src="uploadfiles/image/20170911/5557875ae0a45e1.jpg" alt="">
	</div>
	
	<!-- 内容 -->
	<div class="row row-3">		
			<div class="model-details-title">
				我的订单
			</div>
	</div>

	<!-- 我的订单 -->
	
	<section class="cartMain">
        <div class="cartMain_hd">
            <ul class="order_lists cartTop">
                <li class="list_chk">
                   
                </li>
                <li class="list_con">商品信息</li>
                <li class="list_info">商品参数</li>
                <li class="list_price">单价</li>
                <li class="list_amount">数量</li>
                <li class="list_sum">金额</li>
                <li class="list_op">操作</li>
            </ul>
        </div>
		<?php
			$sql = "select any_value(ordernum) as ordernum,any_value(createtime) as createtime,any_value(status) as status from orderlist where isdelete = 0";
			$sql .= " and uid=".$_SESSION['uid']." group by ordernum order by any_value(createtime) desc";
			$res2 =mysqli_query($conn,$sql) or die("执行命令失败1：".$sql);
			while($row2 = mysqli_fetch_assoc($res2)){
		?>
            <div class="cartBox">
            	<div class="shop_info">
	                <div class="all_check">
	                    <!--店铺全选-->                    
	                </div>
	                <div class="shop_name">
	                   订单号：<?= $row2['ordernum']?>
	                   订单时间：<?= date("Y-m-d h:i",$row2['createtime'])?>                 
					   订单状态：<?php
							switch($row2['status']){
								case '0':
									echo '<span class="red mr30">等待卖家发货</span>';
									break;
								case '1':
									echo '<span class="green mr30">已发货</span>';
									echo '<a href="member.php?action=orderset&ordernum='.$row2['ordernum'].'">确认收货</a>';
									break;
								case '2':
									echo '<span class="gray mr30">已签收</span>';
									break;
							}
					   ?>              
	                   
	                </div>
            	</div>
            	<div class="order_content">
					<?php
						$sql = "select * from orderlist where ordernum='".$row2['ordernum']."'";
						$res = mysqli_query($conn,$sql) or die("执行命令失败2：".$sql);
						while($row = mysqli_fetch_assoc($res)){
					?>
                	<ul class="order_lists">
	                    <li class="list_chk">
	                    </li>
	                    <li class="list_con">
	                        <div class="list_img">
	                        	<a href="javascript:;"><img src="<?=$row['image']?>" alt=""></a>
	                        </div>
	                        <div class="list_text"><a href="show.php?id=<?=$row['sid']?>" target="_blank"><?=$row['name']?></a></div>
	                    </li>
	                    <li class="list_info">
	                        <!--ajax-->
	                    </li>
	                    <li class="list_price">
	                        <p class="price">￥<?=$row['price']?></p>
	                    </li>
	                    <li class="list_amount">
	                        <div class="amount_box red"><?=$row['num']?></div>
	                    </li>
	                    <li class="list_sum">
	                        <p class="sum_price">￥<?=($row['price']*$row['num'])?></p>
	                    </li>
	                    <li class="list_op">	                       
	                    </li>
                	</ul>
					<?php } ?>
                </div>
        	</div>
			<?php } ?>
            
       

        <!--底部-->
    </section>
</div>
<!-- ##########主体（end）########## -->

<!-- ##########页脚########## -->
<?php include "inc/footer.php"; ?>
</body>
</html>